<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Phrase Type Data</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script src="http://code.jquery.com/jquery-1.12.4.min.js"
	integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>

<script src="../docs-assets/Bigfoot.js"></script>
<link href="../docs-assets/Bigfoot.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Phrase Type Data' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../inform7n.html">Inform7</a></li><li><a href="index.html">assertions</a></li><li><a href="index.html#5">Chapter 5: Imperative Code</a></li><li><b>Phrase Type Data</b></li></ul></div>
<p class="purpose">To create, manage, compare the logical specificity of, and assist excerpt parsing concerning, the type of a To phrase.</p>

<ul class="toc"><li><a href="5-ptd.html#SP1">&#167;1. Introduction</a></li><li><a href="5-ptd.html#SP10">&#167;10. Manner of return</a></li><li><a href="5-ptd.html#SP12">&#167;12. The kind of a definition</a></li><li><a href="5-ptd.html#SP14">&#167;14. The tokens</a></li><li><a href="5-ptd.html#SP16">&#167;16. Deprecation</a></li><li><a href="5-ptd.html#SP17">&#167;17. Comparison of PHTDs</a></li><li><a href="5-ptd.html#SP18">&#167;18. Tweaking phrase ordering</a></li><li><a href="5-ptd.html#SP19">&#167;19. Say phrases</a></li><li><a href="5-ptd.html#SP20">&#167;20. Inline phrases</a></li><li><a href="5-ptd.html#SP25">&#167;25. Return value polymorphism</a></li><li><a href="5-ptd.html#SP26">&#167;26. Logging</a></li><li><a href="5-ptd.html#SP28">&#167;28. HTML forms</a></li><li><a href="5-ptd.html#SP29">&#167;29. Problem messages</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Introduction.</b>Each imperative definition, regardless of family, has type data attached.
Only "To..." phrase definitions make full use of this, which is why we use
those as examples throughout, but even rule and adjective definitions set
the "manner of return" (see below).
</p>

<p class="commentary">Type data for a "To..." phrase comes from its prototype text. For example:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">To</span><span class="plain-syntax"> </span><span class="identifier-syntax">sort</span><span class="plain-syntax"> (</span><span class="identifier-syntax">T</span><span class="plain-syntax"> - </span><span class="identifier-syntax">table</span><span class="plain-syntax"> </span><span class="identifier-syntax">name</span><span class="plain-syntax">) </span><span class="identifier-syntax">in</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TC</span><span class="plain-syntax"> - </span><span class="identifier-syntax">table</span><span class="plain-syntax"> </span><span class="identifier-syntax">column</span><span class="plain-syntax">) </span><span class="identifier-syntax">order</span><span class="plain-syntax">: ...</span>

<span class="identifier-syntax">Word</span><span class="plain-syntax"> </span><span class="identifier-syntax">sequence</span><span class="plain-syntax">:             </span><span class="identifier-syntax">Token</span><span class="plain-syntax"> </span><span class="identifier-syntax">sequence</span><span class="plain-syntax">:</span>
<span class="constant-syntax">0</span><span class="plain-syntax">  </span><span class="identifier-syntax">sort</span><span class="plain-syntax">                    </span><span class="constant-syntax">0</span><span class="plain-syntax">  </span><span class="identifier-syntax">T</span><span class="plain-syntax"> - </span><span class="identifier-syntax">table</span><span class="plain-syntax"> </span><span class="identifier-syntax">name</span>
<span class="constant-syntax">1</span><span class="plain-syntax">  </span><span class="constant-syntax">0</span><span class="plain-syntax">                       </span><span class="constant-syntax">1</span><span class="plain-syntax">  </span><span class="identifier-syntax">TC</span><span class="plain-syntax"> - </span><span class="identifier-syntax">table</span><span class="plain-syntax"> </span><span class="identifier-syntax">column</span>
<span class="constant-syntax">2</span><span class="plain-syntax">  </span><span class="identifier-syntax">in</span>
<span class="constant-syntax">3</span><span class="plain-syntax">  </span><span class="constant-syntax">1</span>
<span class="constant-syntax">4</span><span class="plain-syntax">  </span><span class="identifier-syntax">order</span>
</pre>
<p class="commentary">The "word sequence" consists of five integers. Values below <span class="extract"><span class="extract-syntax">MAX_TOKENS_PER_PHRASE</span></span>
mean that a token appears in that position; higher values are word numbers in
the lexed source. (So a phrase prototype cannot appear in the first 10 words of
the source text. Those words are always used on inclusion sentences anyway.)
The "token sequence" lists the flexibly-worded "tokens" in the prototype &mdash; the
parts in brackets.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax"> </span><span class="constant-syntax">10</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">MAX_WORDS_PER_PHRASE</span><span class="plain-syntax"> </span><span class="constant-syntax">32</span><span class="plain-syntax"> </span><span class="comment-syntax"> the most the excerpt parser can hold anyway</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">registration_text</span><span class="plain-syntax">; </span><span class="comment-syntax"> words used to register the excerpt meaning</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">word_sequence</span><span class="plain-syntax">[</span><span class="constant-syntax">MAX_WORDS_PER_PHRASE</span><span class="plain-syntax">]; </span><span class="comment-syntax"> the "word sequence": see above</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">no_words</span><span class="plain-syntax">; </span><span class="comment-syntax"> length of the word sequence</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">id_type_token</span><span class="plain-syntax"> </span><span class="identifier-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="constant-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">no_tokens</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">manner_of_return</span><span class="plain-syntax">; </span><span class="comment-syntax"> one of the </span><span class="extract"><span class="extract-syntax">*_MOR</span></span><span class="comment-syntax"> values</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">return_kind</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">NULL</span></span><span class="comment-syntax"> except in the </span><span class="extract"><span class="extract-syntax">DECIDES_VALUE_MOR</span></span><span class="comment-syntax"> case</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">id_options_data</span><span class="plain-syntax"> </span><span class="identifier-syntax">options_data</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">say_details</span><span class="plain-syntax"> </span><span class="identifier-syntax">as_say</span><span class="plain-syntax">; </span><span class="comment-syntax"> used only for "say" phrases, that is, text substitutions</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inline_details</span><span class="plain-syntax"> </span><span class="identifier-syntax">as_inline</span><span class="plain-syntax">; </span><span class="comment-syntax"> side effects for phrases like C keywords</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">now_deprecated</span><span class="plain-syntax">; </span><span class="comment-syntax"> is this a phrase likely to be withdrawn in future?</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure id_type_data is accessed in 5/ptd2, 5/po and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::new</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::new</span></span>:<br/>Imperative Definitions - <a href="5-id.html#SP6">&#167;6</a><br/>To Phrase Family - <a href="5-tpf.html#SP15">&#167;15</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">.</span><span class="element-syntax">registration_text</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">.</span><span class="element-syntax">manner_of_return</span><span class="plain-syntax"> = </span><span class="constant-syntax">DECIDES_NOTHING_MOR</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">.</span><span class="element-syntax">return_kind</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">.</span><span class="element-syntax">no_words</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">.</span><span class="element-syntax">no_tokens</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">.</span><span class="element-syntax">as_say</span><span class="plain-syntax"> = </span><a href="5-ptd.html#SP19" class="function-link"><span class="function-syntax">IDTypeData::new_say_details</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">.</span><span class="element-syntax">as_inline</span><span class="plain-syntax"> = </span><a href="5-ptd.html#SP20" class="function-link"><span class="function-syntax">IDTypeData::new_inline_details</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">.</span><span class="element-syntax">now_deprecated</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">.</span><span class="element-syntax">options_data</span><span class="plain-syntax"> = </span><a href="5-po.html#SP2" class="function-link"><span class="function-syntax">PhraseOptions::new</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>The two tokens of our example phrase, then, are each stored in one of the
following. Note that a token can match a value<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> as well as a kind, or can match
an elaborate description. Because it can also stand for special constructs
not representable with a <span class="extract"><span class="extract-syntax">parse_node</span></span>, such as "name of a kind of enumerated
value", the <span class="extract"><span class="extract-syntax">construct</span></span> field is occasionally not <span class="extract"><span class="extract-syntax">STANDARD_IDTC</span></span>.
</p>

<ul class="footnotetexts"><li class="footnote" id="fn:1"><p class="inwebfootnote"><sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> The early design of Inform did not permit values as token specifications,
but this lack was in fact reported as a bug &mdash; always a sign that users considered
it a natural thing to do.
<a href="#fnref:1" title="return to text"> &#x21A9;</a></p></li></ul>
<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">ERRONEOUS_IDTC</span><span class="plain-syntax">       </span><span class="constant-syntax">0</span><span class="plain-syntax"> </span><span class="comment-syntax"> used only in parsing, never in an IDTT</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">STANDARD_IDTC</span><span class="plain-syntax">        </span><span class="constant-syntax">1</span><span class="plain-syntax"> </span><span class="comment-syntax"> e.g., </span><span class="extract"><span class="extract-syntax">12</span></span><span class="comment-syntax">, </span><span class="extract"><span class="extract-syntax">number</span></span><span class="comment-syntax">, </span><span class="extract"><span class="extract-syntax">open door</span></span>
<span class="definition-keyword">define</span> <span class="constant-syntax">NEW_LOCAL_IDTC</span><span class="plain-syntax">       </span><span class="constant-syntax">2</span><span class="plain-syntax"> </span><span class="comment-syntax"> e.g., </span><span class="extract"><span class="extract-syntax">nonexisting number variable</span></span>
<span class="definition-keyword">define</span> <span class="constant-syntax">OLD_LOCAL_IDTC</span><span class="plain-syntax">       </span><span class="constant-syntax">3</span><span class="plain-syntax"> </span><span class="comment-syntax"> e.g., </span><span class="extract"><span class="extract-syntax">existing number variable</span></span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONDITION_IDTC</span><span class="plain-syntax">       </span><span class="constant-syntax">4</span><span class="plain-syntax"> </span><span class="comment-syntax"> e.g., </span><span class="extract"><span class="extract-syntax">a condition</span></span>
<span class="definition-keyword">define</span> <span class="constant-syntax">STORAGE_IDTC</span><span class="plain-syntax">         </span><span class="constant-syntax">5</span><span class="plain-syntax"> </span><span class="comment-syntax"> e.g., </span><span class="extract"><span class="extract-syntax">storage</span></span>
<span class="definition-keyword">define</span> <span class="constant-syntax">TABLE_REF_IDTC</span><span class="plain-syntax">       </span><span class="constant-syntax">6</span><span class="plain-syntax"> </span><span class="comment-syntax"> e.g., </span><span class="extract"><span class="extract-syntax">table-reference</span></span>
<span class="definition-keyword">define</span> <span class="constant-syntax">KIND_NAME_IDTC</span><span class="plain-syntax">       </span><span class="constant-syntax">7</span><span class="plain-syntax"> </span><span class="comment-syntax"> e.g., </span><span class="extract"><span class="extract-syntax">name of kind</span></span>
<span class="definition-keyword">define</span> <span class="constant-syntax">VOID_IDTC</span><span class="plain-syntax">            </span><span class="constant-syntax">8</span><span class="plain-syntax"> </span><span class="comment-syntax"> e.g., or in fact only, </span><span class="extract"><span class="extract-syntax">phrase</span></span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">id_type_token</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">construct</span><span class="plain-syntax">; </span><span class="comment-syntax"> one of the </span><span class="extract"><span class="extract-syntax">*_IDTC</span></span><span class="comment-syntax"> values above</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">token_name</span><span class="plain-syntax">; </span><span class="comment-syntax"> name</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">to_match</span><span class="plain-syntax">; </span><span class="comment-syntax"> what we expect to find here</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">token_kind</span><span class="plain-syntax">;</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">id_type_token</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::set_spec</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::set_spec</span></span>:<br/>Parsing Type Data - <a href="5-ptd2.html#SP9_2_1">&#167;9.2.1</a>, <a href="5-ptd2.html#SP9_3_1">&#167;9.3.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_token</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtt</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">spec</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtt</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">to_match</span><span class="plain-syntax"> = </span><span class="identifier-syntax">spec</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtt</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_kind</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Specifications::to_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">spec</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="function-syntax">IDTypeData::token_kind</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::token_kind</span></span>:<br/><a href="5-ptd.html#SP12">&#167;12</a>, <a href="5-ptd.html#SP13">&#167;13</a>, <a href="5-ptd.html#SP19">&#167;19</a>, <a href="5-ptd.html#SP28_1_2_1">&#167;28.1.2.1</a><br/>Parsing Type Data - <a href="5-ptd2.html#SP9_3">&#167;9.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">].</span><span class="element-syntax">token_kind</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure id_type_token is accessed in 5/ptd2 and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>It may seem redundant to store both <span class="extract"><span class="extract-syntax">to_match</span></span> and <span class="extract"><span class="extract-syntax">token_kind</span></span>. Surely
the latter is always just the reduction to a kind of the former? But in fact
not, because of the following function: if it performs a kind substitution
of a kind into a kind variable, the two will no longer match exactly. See
<a href="5-ptd2.html#SP1" class="internal">ParsingIDTypeData::parse</a> for the subtle reason it is needed.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::substitute_spec</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::substitute_spec</span></span>:<br/>Parsing Type Data - <a href="5-ptd2.html#SP9_3_2">&#167;9.3.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> **</span><span class="identifier-syntax">declarations</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">changed</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">substituted</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Kinds::substitute</span><span class="plain-syntax">(</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">].</span><span class="element-syntax">token_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">declarations</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">changed</span><span class="plain-syntax">, </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">changed</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">].</span><span class="element-syntax">to_match</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Specifications::from_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">substituted</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>Say phrases &mdash; text substitutions, that is &mdash; need more:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">say_details</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">say_phrase</span><span class="plain-syntax">; </span><span class="comment-syntax"> one of the three </span><span class="extract"><span class="extract-syntax">*_SAY_PHRASE</span></span><span class="comment-syntax"> values</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">say_phrase_running_on</span><span class="plain-syntax">; </span><span class="comment-syntax"> ignore implied newlines in previous invocation</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">say_phrase_stream_position</span><span class="plain-syntax">; </span><span class="comment-syntax"> one of the </span><span class="extract"><span class="extract-syntax">SSP_*</span></span><span class="comment-syntax"> values above</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">say_phrase_stream_token_at</span><span class="plain-syntax">; </span><span class="comment-syntax"> word number of say stream token name</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">say_phrase_stream_closing_token_at</span><span class="plain-syntax">; </span><span class="comment-syntax"> ditto for choice of ending</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">say_control_structure</span><span class="plain-syntax">; </span><span class="comment-syntax"> one of the four </span><span class="extract"><span class="extract-syntax">*_SAY_CS</span></span><span class="comment-syntax"> values below</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">say_details</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure say_details is private to this section.</li></ul>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>These are for "say control structures", as in "fish [if day is Friday]of
course[end if]" &mdash; the "[if ...]" and "[end if]" both being say phrases which
are control structures.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">NO_SAY_CS</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">IF_SAY_CS</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">OTHERWISE_SAY_CS</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">OTHERWISE_IF_SAY_CS</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">END_IF_SAY_CS</span><span class="plain-syntax"> </span><span class="constant-syntax">4</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. </b>The say stream is the sequence of successive invocations in a single say,
or in a piece of text with substitutions. Some say phrases are compound in that
they must occur in a given sequence.
</p>

<p class="commentary">The following markers are used to identify such say phrases:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">SSP_NONE</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">SSP_START</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">SSP_MIDDLE</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">SSP_END</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. </b>Inline phrase definitions are used to implement what, in other languages,
would be control-structure keywords; so inline phrases sometimes need bells,
whistles and doodads which regular phrases don't.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inline_details</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">invoked_inline_not_as_call</span><span class="plain-syntax">; </span><span class="comment-syntax"> if </span><span class="extract"><span class="extract-syntax">FALSE</span></span><span class="comment-syntax">, none of the rest applies</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">let_phrase</span><span class="plain-syntax">; </span><span class="comment-syntax"> one of the </span><span class="extract"><span class="extract-syntax">*_LET_PHRASE</span></span><span class="comment-syntax"> values below</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">assignment_phrase</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">TRUE</span></span><span class="comment-syntax"> if this has to be typechecked as an assignment</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">offset_assignment_phrase</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">TRUE</span></span><span class="comment-syntax"> if similarly, but as an increase/decrease</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">arithmetical_operation</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">-1</span></span><span class="comment-syntax">, or one of the </span><span class="extract"><span class="extract-syntax">*_OPERATION</span></span><span class="comment-syntax"> constants</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">block_follows</span><span class="plain-syntax">; </span><span class="comment-syntax"> for inline phrases only: followed by a begin... end block?</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> *</span><span class="identifier-syntax">only_in_loop</span><span class="plain-syntax">; </span><span class="comment-syntax"> if not null, the phrase can only be used in this block</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">inline_details</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure inline_details is accessed in 5/ptd2 and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. </b>Where:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">NOT_A_LET_PHRASE</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax"> </span><span class="comment-syntax"> needs to be 0 so that </span><span class="extract"><span class="extract-syntax">let_phrase</span></span><span class="comment-syntax"> can be a C condition</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">ASSIGNMENT_LET_PHRASE</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax"> </span><span class="comment-syntax"> the regular "let"</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">EQUATION_LET_PHRASE</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span><span class="plain-syntax"> </span><span class="comment-syntax"> "let" inviting Inform to solve an equation</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. Manner of return.</b>The "manner of return" (MOR) is similar to the type of value returned by a
function in a C-like language. Thus <span class="extract"><span class="extract-syntax">DECIDES_NOTHING_MOR</span></span> is like being a void
function in C, and <span class="extract"><span class="extract-syntax">DECIDES_VALUE_MOR</span></span> like being a non-void one; <span class="extract"><span class="extract-syntax">DECIDES_CONDITION_MOR</span></span>
is like being a function returning a truth state. The joker in the pack is
<span class="extract"><span class="extract-syntax">DECIDES_NOTHING_AND_RETURNS_MOR</span></span>, which has no analogue in C. It means that
invoking the phrase we are defining will cause an exit from the phrase which
invokes it. If C implemented <span class="extract"><span class="extract-syntax">return</span></span> as a function rather than an inbuilt
keyword, this would be its type.
</p>

<p class="commentary"><span class="extract"><span class="extract-syntax">DECIDES_NOTHING_AND_RETURNS_MOR</span></span> is possible (and meaningful) only for inline
definitions.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">DONT_KNOW_MOR</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax">                     </span><span class="comment-syntax"> but ask me later</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">DECIDES_NOTHING_MOR</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span><span class="plain-syntax">               </span><span class="comment-syntax"> e.g., "award 4 points"</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">DECIDES_VALUE_MOR</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="plain-syntax">                 </span><span class="comment-syntax"> e.g., "square root of 16"</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">DECIDES_CONDITION_MOR</span><span class="plain-syntax"> </span><span class="constant-syntax">4</span><span class="plain-syntax">             </span><span class="comment-syntax"> e.g., "a random chance of 1 in 3 succeeds"</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">DECIDES_NOTHING_AND_RETURNS_MOR</span><span class="plain-syntax"> </span><span class="constant-syntax">5</span><span class="plain-syntax">   </span><span class="comment-syntax"> e.g., "continue the action"</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::set_mor</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::set_mor</span></span>:<br/>Adjectival Definition Family - <a href="5-adf.html#SP6">&#167;6</a><br/>Parsing Type Data - <a href="5-ptd2.html#SP3">&#167;3</a><br/>Rule Family - <a href="5-rf.html#SP8">&#167;8</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">mor</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">K</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">manner_of_return</span><span class="plain-syntax"> = </span><span class="identifier-syntax">mor</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">return_kind</span><span class="plain-syntax"> = </span><span class="identifier-syntax">K</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::get_mor</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">manner_of_return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="function-syntax">IDTypeData::get_return_kind</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::get_return_kind</span></span>:<br/><a href="5-ptd.html#SP12">&#167;12</a><br/>To Phrase Family - <a href="5-tpf.html#SP10_2">&#167;10.2</a><br/>Equations - <a href="7-eqt.html#SP42_3">&#167;42.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">manner_of_return</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">DECIDES_CONDITION_MOR:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">K_truth_state</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">DECIDES_VALUE_MOR:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">return_kind</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">char</span><span class="plain-syntax"> *</span><span class="function-syntax">IDTypeData::describe_manner_of_return</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::describe_manner_of_return</span></span>:<br/><a href="5-ptd.html#SP26">&#167;26</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">mor</span><span class="plain-syntax">, </span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> **</span><span class="identifier-syntax">K</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">mor</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">DECIDES_NOTHING_MOR:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="string-syntax">"no value resulting"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">DECIDES_VALUE_MOR:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">return_kind</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">K</span><span class="plain-syntax">)) *</span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">return_kind</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="string-syntax">"a phrase to decide a value"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">DECIDES_CONDITION_MOR:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="string-syntax">"a phrase to make a decision"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">DECIDES_NOTHING_AND_RETURNS_MOR:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="string-syntax">"a phrase providing an outcome to a rulebook"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="string-syntax">"some phrase"</span><span class="plain-syntax">; </span><span class="comment-syntax"> should never actually be needed</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. The kind of a definition.</b>As noted above, phrases can be such that "kind" is meaningless (consider "if",
or "now"), but it might be tempting to think that for function-like phrases,
at least, the kind tells you everything about when they apply. But this isn't
true. Consider:
</p>

<blockquote>
    <p>To barricade (D - a door): ...</p>
</blockquote>

<blockquote>
    <p>To barricade (D - a closed door): ...</p>
</blockquote>

<p class="commentary">These both have the same kind, <span class="extract"><span class="extract-syntax">phrase door -&gt; nothing</span></span>, and that's reasonable
because they're safe to use in the same circumstances. But they will apply
in different circumstances at run-time.
</p>

<p class="commentary">A further subtlety comes with phrases like:
</p>

<blockquote>
    <p>To juxtapose (name of kind of value K) with (alpha - K) and (beta - K): ...</p>
</blockquote>

<p class="commentary">What's the kind of this? The eventual result of compiling this will be a
function of kind <span class="extract"><span class="extract-syntax">phrase (V, V) -&gt; nothing</span></span>, where V is the particular kind
it is used for. But this is not the kind of the definition itself, which
clearly has three parameters. If we give it the kind <span class="extract"><span class="extract-syntax">phrase (K, K) -&gt; nothing</span></span>
then Inform will infer the kind K from the parameters supplied as <span class="extract"><span class="extract-syntax">alpha</span></span>
and <span class="extract"><span class="extract-syntax">beta</span></span> in any given invocation. For example, "juxtapose numbers with 12
and 31" would then correctly infer that <span class="extract"><span class="extract-syntax">K = number</span></span>. But in some subtle cases
of ambiguity it infers the wrong answer, and anyway, the idea is to take K
from the kind explicitly named in the <span class="extract"><span class="extract-syntax">name of kind of value K</span></span> parameter.
So, internally, Inform regards the kind of this definition as
<span class="extract"><span class="extract-syntax">phrase (K, K, K) -&gt; nothing</span></span>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="function-syntax">IDTypeData::kind</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::kind</span></span>:<br/><a href="5-ptd.html#SP13">&#167;13</a><br/>To Phrase Family - <a href="5-tpf.html#SP10_1">&#167;10.1</a>, <a href="5-tpf.html#SP15">&#167;15</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">argument_kinds</span><span class="plain-syntax">[</span><span class="constant-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;idtd-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">argument_kinds</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><a href="5-ptd.html#SP3" class="function-link"><span class="function-syntax">IDTypeData::token_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">R</span><span class="plain-syntax"> = </span><a href="5-ptd.html#SP10" class="function-link"><span class="function-syntax">IDTypeData::get_return_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">Kinds::function_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">, </span><span class="identifier-syntax">argument_kinds</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP13" class="paragraph-anchor"></a><b>&#167;13. </b>It's useful to test whether the definition in fact involves kind variables:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::contains_variables</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">Kinds::contains</span><span class="plain-syntax">(</span><a href="5-ptd.html#SP12" class="function-link"><span class="function-syntax">IDTypeData::kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">), </span><span class="identifier-syntax">CON_KIND_VARIABLE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::token_contains_variable</span><button class="popup" onclick="togglePopup('usagePopup9')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup9">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::token_contains_variable</span></span>:<br/>To Phrase Family - <a href="5-tpf.html#SP10_2">&#167;10.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">v</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;idtd-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Kinds::Behaviour::involves_var</span><span class="plain-syntax">(</span><a href="5-ptd.html#SP3" class="function-link"><span class="function-syntax">IDTypeData::token_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">), </span><span class="identifier-syntax">v</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP14" class="paragraph-anchor"></a><b>&#167;14. The tokens.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::get_no_tokens</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::index_of_token_creating_a_variable</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;idtd-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">].</span><span class="element-syntax">construct</span><span class="plain-syntax"> == </span><span class="constant-syntax">NEW_LOCAL_IDTC</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP15" class="paragraph-anchor"></a><b>&#167;15. </b>This odd-looking question is asked when handling the ambiguity between the
name of a property ("carrying capacity", say) as a value in its own right,
and the same name metonymically referring to the value of the property for
a given instance ("carrying capacity of the player", say).
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::preamble_requires_property_value</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;idtd-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Lvalues::get_storage_form</span><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">].</span><span class="element-syntax">to_match</span><span class="plain-syntax">) == </span><span class="identifier-syntax">PROPERTY_VALUE_NT</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP16" class="paragraph-anchor"></a><b>&#167;16. Deprecation.</b>Phrases which are "deprecated" are those defined by the Standard Rules, or
other extensions in the standard Inform installation, which we now think are
redundant or a bad idea: we don't want to withdraw them without warning, so
the procedure is to deprecate them in one major build and withdraw them
in the next.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::deprecated</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">now_deprecated</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::deprecate_phrase</span><button class="popup" onclick="togglePopup('usagePopup10')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup10">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::deprecate_phrase</span></span>:<br/>Parsing Type Data - <a href="5-ptd2.html#SP6">&#167;6</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">now_deprecated</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP17" class="paragraph-anchor"></a><b>&#167;17. Comparison of PHTDs.</b>This is used when sorting "To..." phrases in order of logical priority.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::comparison</span><button class="popup" onclick="togglePopup('usagePopup11')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup11">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::comparison</span></span>:<br/>To Phrase Family - <a href="5-tpf.html#SP8">&#167;8</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">, </span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">phtd1</span><span class="plain-syntax"> == </span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">EQUAL_PH</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-ptd.html#SP17_1" class="named-paragraph-link"><span class="named-paragraph">Loop construct keywords have priority</span><span class="named-paragraph-number">17.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-ptd.html#SP17_2" class="named-paragraph-link"><span class="named-paragraph">More fixed words beats fewer</span><span class="named-paragraph-number">17.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-ptd.html#SP17_3" class="named-paragraph-link"><span class="named-paragraph">More tokens beats fewer</span><span class="named-paragraph-number">17.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-ptd.html#SP17_4" class="named-paragraph-link"><span class="named-paragraph">Next use alphabetical order, counting tokens as after the Zs</span><span class="named-paragraph-number">17.4</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-ptd.html#SP17_5" class="named-paragraph-link"><span class="named-paragraph">Finally try comparing the to-match specifications of the tokens</span><span class="named-paragraph-number">17.5</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">INCOMPARABLE_PH</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP17_1" class="paragraph-anchor"></a><b>&#167;17.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Loop construct keywords have priority</span><span class="named-paragraph-number">17.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><a href="5-ptd.html#SP18" class="function-link"><span class="function-syntax">IDTypeData::inline_type_data_comparison</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">, </span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> != </span><span class="constant-syntax">EQUAL_PH</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd.html#SP17">&#167;17</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP17_2" class="paragraph-anchor"></a><b>&#167;17.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">More fixed words beats fewer</span><span class="named-paragraph-number">17.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">fw1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_words</span><span class="plain-syntax"> - </span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">fw2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_words</span><span class="plain-syntax"> - </span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">fw1</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">fw2</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">BEFORE_PH</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">fw1</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">fw2</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">AFTER_PH</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd.html#SP17">&#167;17</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP17_3" class="paragraph-anchor"></a><b>&#167;17.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">More tokens beats fewer</span><span class="named-paragraph-number">17.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">BEFORE_PH</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">AFTER_PH</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd.html#SP17">&#167;17</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP17_4" class="paragraph-anchor"></a><b>&#167;17.4. </b>At this point the two phrases have the same number of words and tokens,
but the words may be different and/or the tokens in different places.
We might for example be comparing these two:
</p>

<blockquote>
    <p>To grab (the prize - an object) swiftly: ...</p>
</blockquote>

<blockquote>
    <p>To grab at (the rosette - an object): ...</p>
</blockquote>

<p class="commentary">We use alphabetical order, placing "grab ZZZZZZ swiftly" after "grab at ZZZZZZ".
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Next use alphabetical order, counting tokens as after the Zs</span><span class="named-paragraph-number">17.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;phtd1-&gt;</span><span class="element-syntax">no_words</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">word_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] &lt; </span><span class="constant-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">word_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] &gt;= </span><span class="constant-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">AFTER_PH</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">word_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] &lt; </span><span class="constant-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">BEFORE_PH</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wide::cmp</span><span class="plain-syntax">(</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Lexer::word_raw_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">word_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Lexer::word_raw_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">word_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]));</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">x</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">AFTER_PH</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">x</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">BEFORE_PH</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd.html#SP17">&#167;17</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP17_5" class="paragraph-anchor"></a><b>&#167;17.5. </b>Now our two phrases have identical wording, and tokens in the same positions,
but may have different specifications for them. For example:
</p>

<blockquote>
    <p>To grab at (the rosette - an object): ...</p>
</blockquote>

<blockquote>
    <p>To grab at (the rosette - a thing on the table): ...</p>
</blockquote>

<p class="commentary">We give priority to the second of these, because it's more specific. On
the other hand these are simply incomparable:
</p>

<blockquote>
    <p>To grab at (the rosette - an object): ...</p>
</blockquote>

<blockquote>
    <p>To grab at (the prime - a number): ...</p>
</blockquote>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Finally try comparing the to-match specifications of the tokens</span><span class="named-paragraph-number">17.5</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">possibly_subschema</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">, </span><span class="identifier-syntax">possibly_superschema</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;phtd1-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">spec1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">].</span><span class="element-syntax">to_match</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">spec2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">].</span><span class="element-syntax">to_match</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="5-ptd.html#SP17_5_2" class="named-paragraph-link"><span class="named-paragraph">See if the ith token rules out being a sub- or superschema</span><span class="named-paragraph-number">17.5.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">possibly_subschema</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">possibly_superschema</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="5-ptd.html#SP17_5_1" class="named-paragraph-link"><span class="named-paragraph">These are worryingly similar in wording, so check the return kinds</span><span class="named-paragraph-number">17.5.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">possibly_subschema</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">SUBSCHEMA_PH</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">possibly_superschema</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">SUPERSCHEMA_PH</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd.html#SP17">&#167;17</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP17_5_1" class="paragraph-anchor"></a><b>&#167;17.5.1. </b>We need to watch out for this sort of thing:
</p>

<blockquote>
    <p>To decide what number is my special value: decide on 4.</p>
</blockquote>

<blockquote>
    <p>To decide what person is my special value: decide on the player.</p>
</blockquote>

<p class="commentary">which makes "my special value" of a kind which can't be decided; but
we can't just compare the return kinds, because that might pick up
false positives in the case of kind variables, etc.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">These are worryingly similar in wording, so check the return kinds</span><span class="named-paragraph-number">17.5.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">manner_of_return</span><span class="plain-syntax"> != </span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">manner_of_return</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">        ((</span><span class="identifier-syntax">Kinds::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">return_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">return_kind</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">Kinds::Behaviour::definite</span><span class="plain-syntax">(</span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">return_kind</span><span class="plain-syntax">))))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">CONFLICTED_PH</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd.html#SP17_5">&#167;17.5</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP17_5_2" class="paragraph-anchor"></a><b>&#167;17.5.2. </b>We delegate to <span class="extract"><span class="extract-syntax">Specifications::compare_specificity</span></span> to decide what's more
specific, but note that this routine can return 0 (meaning, equally
specific) for two different reasons: because the specifications are basically
the same as each other, or because they're completely different but have
about the same complexity. The <span class="extract"><span class="extract-syntax">wont_mix</span></span> flag is set in the latter case.
</p>

<p class="commentary">Because the test is made by seeing if one specification matches another, we
also protect it from the special "nonexisting variable" tokens,
used only in inline phrase preambles. It would otherwise think "existing
variable" is more specific than "new variable", which isn't helpful.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">See if the ith token rules out being a sub- or superschema</span><span class="named-paragraph-number">17.5.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">].</span><span class="element-syntax">construct</span><span class="plain-syntax"> == </span><span class="constant-syntax">NEW_LOCAL_IDTC</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">].</span><span class="element-syntax">construct</span><span class="plain-syntax"> != </span><span class="constant-syntax">NEW_LOCAL_IDTC</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">possibly_superschema</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">].</span><span class="element-syntax">construct</span><span class="plain-syntax"> != </span><span class="constant-syntax">NEW_LOCAL_IDTC</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">].</span><span class="element-syntax">construct</span><span class="plain-syntax"> == </span><span class="constant-syntax">NEW_LOCAL_IDTC</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">possibly_subschema</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">wont_mix</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">r</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Specifications::compare_specificity</span><span class="plain-syntax">(</span><span class="identifier-syntax">spec1</span><span class="plain-syntax">, </span><span class="identifier-syntax">spec2</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">wont_mix</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wont_mix</span><span class="plain-syntax">) { </span><span class="identifier-syntax">possibly_subschema</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">; </span><span class="identifier-syntax">possibly_superschema</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">r</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">possibly_subschema</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">r</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">possibly_superschema</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd.html#SP17_5">&#167;17.5</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP18" class="paragraph-anchor"></a><b>&#167;18. Tweaking phrase ordering.</b>Phrases marked for use only within a particular control structure, such as
"otherwise" within "if", automatically precede all other phrases. The idea
is that these are keywords whose effect is so powerful that we don't want
any chance of ambiguities arising due to unwise phrase definitions in the
source text.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::inline_type_data_comparison</span><button class="popup" onclick="togglePopup('usagePopup12')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup12">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::inline_type_data_comparison</span></span>:<br/><a href="5-ptd.html#SP17_1">&#167;17.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">, </span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">only_in_loop</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">only_in_loop</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">BEFORE_PH</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">phtd2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">only_in_loop</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">phtd1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">only_in_loop</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">AFTER_PH</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">EQUAL_PH</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP19" class="paragraph-anchor"></a><b>&#167;19. Say phrases.</b></p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">NOT_A_SAY_PHRASE</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax"> </span><span class="comment-syntax"> needs to be 0 so that </span><span class="extract"><span class="extract-syntax">sd.say_phrase</span></span><span class="comment-syntax"> can be a C condition</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">A_MISCELLANEOUS_SAY_PHRASE</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">THE_PRIMORDIAL_SAY_PHRASE</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">say_details</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::new_say_details</span><button class="popup" onclick="togglePopup('usagePopup13')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup13">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::new_say_details</span></span>:<br/><a href="5-ptd.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">say_details</span><span class="plain-syntax"> </span><span class="identifier-syntax">sd</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">sd</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase</span><span class="plain-syntax"> = </span><span class="constant-syntax">NOT_A_SAY_PHRASE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">sd</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase_running_on</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">sd</span><span class="plain-syntax">.</span><span class="element-syntax">say_control_structure</span><span class="plain-syntax"> = </span><span class="constant-syntax">NO_SAY_CS</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">sd</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase_stream_position</span><span class="plain-syntax"> = </span><span class="constant-syntax">SSP_NONE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">sd</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase_stream_token_at</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">sd</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase_stream_closing_token_at</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">sd</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">first_say_made</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::make_sd</span><button class="popup" onclick="togglePopup('usagePopup14')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup14">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::make_sd</span></span>:<br/>Parsing Type Data - <a href="5-ptd2.html#SP6_2">&#167;6.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">say_details</span><span class="plain-syntax"> *</span><span class="identifier-syntax">sd</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">ro</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">cs</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">at</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">cat</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">sd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">say_phrase</span><span class="plain-syntax"> = </span><span class="constant-syntax">A_MISCELLANEOUS_SAY_PHRASE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">first_say_made</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">sd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">say_phrase</span><span class="plain-syntax"> = </span><span class="constant-syntax">THE_PRIMORDIAL_SAY_PHRASE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">first_say_made</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">sd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">say_phrase_running_on</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ro</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cs</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">sd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">say_control_structure</span><span class="plain-syntax"> = </span><span class="identifier-syntax">cs</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pos</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">sd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">say_phrase_stream_position</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pos</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">at</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">sd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">say_phrase_stream_token_at</span><span class="plain-syntax"> = </span><span class="identifier-syntax">at</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cat</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">sd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">say_phrase_stream_closing_token_at</span><span class="plain-syntax"> = </span><span class="identifier-syntax">cat</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::log_say_details</span><button class="popup" onclick="togglePopup('usagePopup15')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup15">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::log_say_details</span></span>:<br/><a href="5-ptd.html#SP26">&#167;26</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">say_details</span><span class="plain-syntax"> </span><span class="identifier-syntax">sd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">sd</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">NOT_A_SAY_PHRASE:</span><span class="plain-syntax"> </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">A_MISCELLANEOUS_SAY_PHRASE:</span><span class="plain-syntax"> </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  A_MISCELLANEOUS_SAY_PHRASE\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">THE_PRIMORDIAL_SAY_PHRASE:</span><span class="plain-syntax"> </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  THE_PRIMORDIAL_SAY_PHRASE\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">default:</span><span class="plain-syntax"> </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  &lt;invalid say phrase status&gt;\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">sd</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase_running_on</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  running on from previous say invocation without implied newline\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">sd</span><span class="plain-syntax">.</span><span class="element-syntax">say_control_structure</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">NO_SAY_CS:</span><span class="plain-syntax"> </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">IF_SAY_CS:</span><span class="plain-syntax"> </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  IF_SAY_CS\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">END_IF_SAY_CS:</span><span class="plain-syntax"> </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  END_IF_SAY_CS\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">OTHERWISE_SAY_CS:</span><span class="plain-syntax"> </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  OTHERWISE_SAY_CS\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">OTHERWISE_IF_SAY_CS:</span><span class="plain-syntax"> </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  OTHERWISE_IF_SAY_CS\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">default:</span><span class="plain-syntax"> </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  &lt;invalid say phrase status&gt;\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::is_a_say_phrase</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_body</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">idb</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">type_data</span><span class="plain-syntax">.</span><span class="element-syntax">as_say</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::is_a_say_X_phrase</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_say</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase</span><span class="plain-syntax"> == </span><span class="constant-syntax">NOT_A_SAY_PHRASE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_words</span><span class="plain-syntax"> == </span><span class="constant-syntax">2</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">word_sequence</span><span class="plain-syntax">[1] &lt; </span><span class="constant-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::is_a_spare_say_X_phrase</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_say</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase</span><span class="plain-syntax"> == </span><span class="constant-syntax">NOT_A_SAY_PHRASE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_words</span><span class="plain-syntax"> == </span><span class="constant-syntax">2</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">word_sequence</span><span class="plain-syntax">[1] &lt; </span><span class="constant-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><a href="5-ptd.html#SP3" class="function-link"><span class="function-syntax">IDTypeData::token_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">K</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Kinds::Behaviour::definite</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::is_the_primordial_say</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_say</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase</span><span class="plain-syntax"> == </span><span class="constant-syntax">THE_PRIMORDIAL_SAY_PHRASE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::get_say_data</span><span class="plain-syntax">(</span><span class="reserved-syntax">say_details</span><span class="plain-syntax"> *</span><span class="identifier-syntax">sd</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> *</span><span class="identifier-syntax">say_cs</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ssp_tok</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ssp_ctok</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ssp_pos</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">say_cs</span><span class="plain-syntax"> = </span><span class="identifier-syntax">sd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">say_control_structure</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">ssp_tok</span><span class="plain-syntax"> = </span><span class="identifier-syntax">sd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">say_phrase_stream_token_at</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">ssp_ctok</span><span class="plain-syntax"> = </span><span class="identifier-syntax">sd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">say_phrase_stream_closing_token_at</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">ssp_pos</span><span class="plain-syntax"> = </span><span class="identifier-syntax">sd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">say_phrase_stream_position</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::preface_for_say_HTML</span><button class="popup" onclick="togglePopup('usagePopup16')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup16">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::preface_for_say_HTML</span></span>:<br/><a href="5-ptd.html#SP28">&#167;28</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">say_details</span><span class="plain-syntax"> </span><span class="identifier-syntax">sd</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">paste_format</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">sd</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">sd</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase</span><span class="plain-syntax"> != </span><span class="constant-syntax">THE_PRIMORDIAL_SAY_PHRASE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">paste_format</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PASTE_PHRASE_FORMAT:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"["</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">INDEX_PHRASE_FORMAT:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"say \"["</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">paste_format</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PASTE_PHRASE_FORMAT:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"say \"\""</span><span class="plain-syntax">); </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NOT_APPLICABLE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">INDEX_PHRASE_FORMAT:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"say \""</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::epilogue_for_say_HTML</span><button class="popup" onclick="togglePopup('usagePopup17')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup17">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::epilogue_for_say_HTML</span></span>:<br/><a href="5-ptd.html#SP28">&#167;28</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">say_details</span><span class="plain-syntax"> </span><span class="identifier-syntax">sd</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">paste_format</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">sd</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">sd</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase</span><span class="plain-syntax"> != </span><span class="constant-syntax">THE_PRIMORDIAL_SAY_PHRASE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">paste_format</span><span class="plain-syntax"> == </span><span class="constant-syntax">PASTE_PHRASE_FORMAT</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"]"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">paste_format</span><span class="plain-syntax"> == </span><span class="constant-syntax">INDEX_PHRASE_FORMAT</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"]\""</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">paste_format</span><span class="plain-syntax"> == </span><span class="constant-syntax">INDEX_PHRASE_FORMAT</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\""</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::ssp_matches</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">ssp_tok</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">list_pos</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> *</span><span class="identifier-syntax">W</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">this_tok</span><span class="plain-syntax"> = </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_say</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase_stream_token_at</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">this_pos</span><span class="plain-syntax"> = </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_say</span><span class="plain-syntax">.</span><span class="element-syntax">say_phrase_stream_position</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">this_tok</span><span class="plain-syntax"> == -1) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">this_pos</span><span class="plain-syntax"> != </span><span class="identifier-syntax">list_pos</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">compare_words</span><span class="plain-syntax">(</span><span class="identifier-syntax">ssp_tok</span><span class="plain-syntax">, </span><span class="identifier-syntax">this_tok</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">W</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::trim_first_word</span><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">registration_text</span><span class="plain-syntax">); </span><span class="comment-syntax"> to remove the word "say"</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP20" class="paragraph-anchor"></a><b>&#167;20. Inline phrases.</b>On some platforms, notably Android, <span class="extract"><span class="extract-syntax">inline</span></span> is a reserved word in some versions
of <span class="extract"><span class="extract-syntax">gcc</span></span>, so we need to be careful not to call any variables or structure members
by than name.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">NO_BLOCK_FOLLOWS</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">              </span><span class="comment-syntax"> this needs to be 0, to make if conditions work</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">MISCELLANEOUS_BLOCK_FOLLOWS</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONDITIONAL_BLOCK_FOLLOWS</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">LOOP_BODY_BLOCK_FOLLOWS</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inline_details</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::new_inline_details</span><button class="popup" onclick="togglePopup('usagePopup18')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup18">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::new_inline_details</span></span>:<br/><a href="5-ptd.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inline_details</span><span class="plain-syntax"> </span><span class="identifier-syntax">id</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">id</span><span class="plain-syntax">.</span><span class="element-syntax">invoked_inline_not_as_call</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">id</span><span class="plain-syntax">.</span><span class="element-syntax">let_phrase</span><span class="plain-syntax"> = </span><span class="constant-syntax">NOT_A_LET_PHRASE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">id</span><span class="plain-syntax">.</span><span class="element-syntax">block_follows</span><span class="plain-syntax"> = </span><span class="constant-syntax">NO_BLOCK_FOLLOWS</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">id</span><span class="plain-syntax">.</span><span class="element-syntax">only_in_loop</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">id</span><span class="plain-syntax">.</span><span class="element-syntax">assignment_phrase</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">id</span><span class="plain-syntax">.</span><span class="element-syntax">offset_assignment_phrase</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">id</span><span class="plain-syntax">.</span><span class="element-syntax">arithmetical_operation</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">id</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP21" class="paragraph-anchor"></a><b>&#167;21. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">no_lets_made</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::make_id</span><button class="popup" onclick="togglePopup('usagePopup19')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup19">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::make_id</span></span>:<br/>Parsing Type Data - <a href="5-ptd2.html#SP6">&#167;6</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inline_details</span><span class="plain-syntax"> *</span><span class="identifier-syntax">id</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">op</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">assgn</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">offset</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">let</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">blk</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">only_in</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">id</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">arithmetical_operation</span><span class="plain-syntax"> = </span><span class="identifier-syntax">op</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">id</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">assignment_phrase</span><span class="plain-syntax"> = </span><span class="identifier-syntax">assgn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">id</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">offset_assignment_phrase</span><span class="plain-syntax"> = </span><span class="identifier-syntax">offset</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">let</span><span class="plain-syntax"> == </span><span class="constant-syntax">ASSIGNMENT_LET_PHRASE</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">no_lets_made</span><span class="plain-syntax">++ &gt;= </span><span class="constant-syntax">3</span><span class="plain-syntax">)) </span><span class="identifier-syntax">let</span><span class="plain-syntax"> = </span><span class="constant-syntax">NOT_A_LET_PHRASE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">id</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">let_phrase</span><span class="plain-syntax"> = </span><span class="identifier-syntax">let</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">id</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">block_follows</span><span class="plain-syntax"> = </span><span class="identifier-syntax">blk</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">only_in</span><span class="plain-syntax"> == -1) </span><span class="identifier-syntax">id</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">only_in_loop</span><span class="plain-syntax"> = </span><span class="identifier-syntax">U</span><span class="string-syntax">"loop"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">only_in</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">id</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">only_in_loop</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Lexer::word_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">only_in</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP22" class="paragraph-anchor"></a><b>&#167;22. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::log_inline_details</span><button class="popup" onclick="togglePopup('usagePopup20')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup20">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::log_inline_details</span></span>:<br/><a href="5-ptd.html#SP26">&#167;26</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inline_details</span><span class="plain-syntax"> </span><span class="identifier-syntax">id</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">id</span><span class="plain-syntax">.</span><span class="element-syntax">block_follows</span><span class="plain-syntax">) </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  block follows\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">id</span><span class="plain-syntax">.</span><span class="element-syntax">let_phrase</span><span class="plain-syntax"> != </span><span class="constant-syntax">NOT_A_LET_PHRASE</span><span class="plain-syntax">) </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  let phrase (%d)\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">id</span><span class="plain-syntax">.</span><span class="element-syntax">let_phrase</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">id</span><span class="plain-syntax">.</span><span class="element-syntax">only_in_loop</span><span class="plain-syntax">) </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  may only be used in a %w body\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">id</span><span class="plain-syntax">.</span><span class="element-syntax">only_in_loop</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">id</span><span class="plain-syntax">.</span><span class="element-syntax">invoked_inline_not_as_call</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE:</span><span class="plain-syntax"> </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  invoked inline\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE:</span><span class="plain-syntax"> </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  invoked by I6 function call\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP23" class="paragraph-anchor"></a><b>&#167;23. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::make_inline</span><button class="popup" onclick="togglePopup('usagePopup21')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup21">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::make_inline</span></span>:<br/>Imperative Definitions - <a href="5-id.html#SP9">&#167;9</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"null idtd"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">invoked_inline_not_as_call</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::invoked_inline</span><button class="popup" onclick="togglePopup('usagePopup22')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup22">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::invoked_inline</span></span>:<br/>To Phrase Family - <a href="5-tpf.html#SP10_3">&#167;10.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_body</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idb</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">idb</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">type_data</span><span class="plain-syntax">.</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">invoked_inline_not_as_call</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP24" class="paragraph-anchor"></a><b>&#167;24. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::is_a_let_assignment</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_body</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idb</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idb</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">type_data</span><span class="plain-syntax">.</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">let_phrase</span><span class="plain-syntax"> == </span><span class="constant-syntax">ASSIGNMENT_LET_PHRASE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::is_a_let_equation</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_body</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idb</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idb</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">type_data</span><span class="plain-syntax">.</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">let_phrase</span><span class="plain-syntax"> == </span><span class="constant-syntax">EQUATION_LET_PHRASE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::arithmetic_operation</span><button class="popup" onclick="togglePopup('usagePopup23')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup23">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::arithmetic_operation</span></span>:<br/>To Phrase Family - <a href="5-tpf.html#SP10_2">&#167;10.2</a><br/>Equations - <a href="7-eqt.html#SP42_3">&#167;42.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_body</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idb</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">idb</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">type_data</span><span class="plain-syntax">.</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">arithmetical_operation</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::is_arithmetic_phrase</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_body</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="5-ptd.html#SP24" class="function-link"><span class="function-syntax">IDTypeData::arithmetic_operation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) == </span><span class="identifier-syntax">PLUS_OPERATION</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="5-ptd.html#SP24" class="function-link"><span class="function-syntax">IDTypeData::arithmetic_operation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) == </span><span class="identifier-syntax">MINUS_OPERATION</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="5-ptd.html#SP24" class="function-link"><span class="function-syntax">IDTypeData::arithmetic_operation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) == </span><span class="identifier-syntax">TIMES_OPERATION</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="5-ptd.html#SP24" class="function-link"><span class="function-syntax">IDTypeData::arithmetic_operation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) == </span><span class="identifier-syntax">DIVIDE_OPERATION</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="5-ptd.html#SP24" class="function-link"><span class="function-syntax">IDTypeData::arithmetic_operation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) == </span><span class="identifier-syntax">REMAINDER_OPERATION</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="5-ptd.html#SP24" class="function-link"><span class="function-syntax">IDTypeData::arithmetic_operation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) == </span><span class="identifier-syntax">APPROXIMATE_OPERATION</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="5-ptd.html#SP24" class="function-link"><span class="function-syntax">IDTypeData::arithmetic_operation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) == </span><span class="identifier-syntax">ROOT_OPERATION</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="5-ptd.html#SP24" class="function-link"><span class="function-syntax">IDTypeData::arithmetic_operation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) == </span><span class="identifier-syntax">REALROOT_OPERATION</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="5-ptd.html#SP24" class="function-link"><span class="function-syntax">IDTypeData::arithmetic_operation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) == </span><span class="identifier-syntax">CUBEROOT_OPERATION</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::is_assignment_phrase</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_body</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idb</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">idb</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">type_data</span><span class="plain-syntax">.</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">assignment_phrase</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::is_offset_assignment_phrase</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_body</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idb</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">idb</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">type_data</span><span class="plain-syntax">.</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">offset_assignment_phrase</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> *</span><span class="function-syntax">IDTypeData::only_in</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_body</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">idb</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">type_data</span><span class="plain-syntax">.</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">only_in_loop</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::block_follows</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_body</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idb</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">idb</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">type_data</span><span class="plain-syntax">.</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">block_follows</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP25" class="paragraph-anchor"></a><b>&#167;25. Return value polymorphism.</b>Inform has two sorts of polymorphism &mdash; that is, there are two ways in which
the kinds of phrases can vary. One is by means of kind variables, the other
is for arithmetic operations such as "plus" or "times": where the range of
kinds which can go in is quite large, and the kind which comes out is then
determined on dimensional grounds. (A number times a length is another
length, but a number plus a length is an error, and so on.)
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::return_decided_dimensionally</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">manner_of_return</span><span class="plain-syntax"> == </span><span class="constant-syntax">DECIDES_VALUE_MOR</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">arithmetical_operation</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP26" class="paragraph-anchor"></a><b>&#167;26. Logging.</b>The debugging log is simple:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::log</span><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  IDTD: register as &lt;%W&gt;\n  %s\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">registration_text</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><a href="5-ptd.html#SP11" class="function-link"><span class="function-syntax">IDTypeData::describe_manner_of_return</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">manner_of_return</span><span class="plain-syntax">, </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">manner_of_return</span><span class="plain-syntax"> == </span><span class="constant-syntax">DECIDES_VALUE_MOR</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  decides value of kind %u\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">return_kind</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-ptd.html#SP26_1" class="named-paragraph-link"><span class="named-paragraph">Log the word sequence</span><span class="named-paragraph-number">26.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-ptd.html#SP26_2" class="named-paragraph-link"><span class="named-paragraph">Log the token sequence</span><span class="named-paragraph-number">26.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="5-ptd.html#SP22" class="function-link"><span class="function-syntax">IDTypeData::log_inline_details</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_inline</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="5-ptd.html#SP19" class="function-link"><span class="function-syntax">IDTypeData::log_say_details</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_say</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP26_1" class="paragraph-anchor"></a><b>&#167;26.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Log the word sequence</span><span class="named-paragraph-number">26.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;idtd-&gt;</span><span class="element-syntax">no_words</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">word_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] &lt; </span><span class="constant-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"#%d "</span><span class="plain-syntax">, </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">word_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"%N "</span><span class="plain-syntax">, </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">word_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"(%d words)\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_words</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd.html#SP26">&#167;26</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP26_2" class="paragraph-anchor"></a><b>&#167;26.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Log the token sequence</span><span class="named-paragraph-number">26.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;idtd-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"  #%d: \"%W\" = $P\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">].</span><span class="element-syntax">token_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">].</span><span class="element-syntax">to_match</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd.html#SP26">&#167;26</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP27" class="paragraph-anchor"></a><b>&#167;27. </b>Abbreviatedly:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::log_briefly</span><button class="popup" onclick="togglePopup('usagePopup24')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup24">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::log_briefly</span></span>:<br/>Imperative Definitions - <a href="5-id.html#SP10">&#167;10</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) { </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;null-IDTD&gt;"</span><span class="plain-syntax">); </span><span class="reserved-syntax">return</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"\"%W\""</span><span class="plain-syntax">, </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">registration_text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">manner_of_return</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">DECIDES_CONDITION_MOR:</span><span class="plain-syntax"> </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"(=condition)"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">DECIDES_VALUE_MOR:</span><span class="plain-syntax"> </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"(=%u)"</span><span class="plain-syntax">, </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">return_kind</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP28" class="paragraph-anchor"></a><b>&#167;28. HTML forms.</b>But the debugging log isn't the only place we want to write out the phrase
type to: it also gets written to HTML, not just openly but also in the
Javascript pasted form. One reason for this is to write entries in the
Phrasebook Index, but another is to show what Inform was trying to do when
issuing a Problem message: usually it has managed partially to match up the
tokens in a phrase, and has a mostly-formed but incorrect invocation as
a result. If such an invocation <span class="extract"><span class="extract-syntax">inv</span></span> is supplied here, than the attempted
match is shown.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">PASTE_PHRASE_FORMAT</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax"> </span><span class="comment-syntax"> in the insert-to-source text pasted by a button in the Index</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">INDEX_PHRASE_FORMAT</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span><span class="plain-syntax"> </span><span class="comment-syntax"> a simpler version good enough for most purposes</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::write_HTML_representation</span><button class="popup" onclick="togglePopup('usagePopup25')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup25">Usage of <span class="code-font"><span class="function-syntax">IDTypeData::write_HTML_representation</span></span>:<br/><a href="5-ptd.html#SP29">&#167;29</a><br/>Imperative Definitions - <a href="5-id.html#SP10">&#167;10</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">paste_format</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inv</span><span class="plain-syntax">) {</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">seq_from</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">seq_to</span><span class="plain-syntax"> = </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_words</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">writing_a_say</span><span class="plain-syntax"> = </span><a href="5-ptd.html#SP19" class="function-link"><span class="function-syntax">IDTypeData::preface_for_say_HTML</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_say</span><span class="plain-syntax">, </span><span class="identifier-syntax">paste_format</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">writing_a_say</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NOT_APPLICABLE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">writing_a_say</span><span class="plain-syntax">) </span><span class="identifier-syntax">seq_from</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="comment-syntax"> skip the first word, which is necessarily "say" in this case</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">block_follows</span><span class="plain-syntax">) </span><span class="identifier-syntax">seq_to</span><span class="plain-syntax">--; </span><span class="comment-syntax"> skip the last word, which is a block marker</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">paste_format</span><span class="plain-syntax"> == </span><span class="constant-syntax">PASTE_PHRASE_FORMAT</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">writing_a_say</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">word_sequence</span><span class="plain-syntax">[0] &lt; </span><span class="constant-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">) </span><span class="identifier-syntax">seq_from</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">word_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">seq_to</span><span class="plain-syntax">-1] &lt; </span><span class="constant-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">block_follows</span><span class="plain-syntax"> == </span><span class="constant-syntax">NO_BLOCK_FOLLOWS</span><span class="plain-syntax">)) </span><span class="identifier-syntax">seq_to</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-ptd.html#SP28_1" class="named-paragraph-link"><span class="named-paragraph">Describe the word sequence</span><span class="named-paragraph-number">28.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">block_follows</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">paste_format</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">":\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">":"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML_TAG</span><span class="plain-syntax">(</span><span class="string-syntax">"br"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&amp;nbsp;&amp;nbsp;&amp;nbsp;"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"i"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::begin_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"phrasetokenvaluetext"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"phrases"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::end_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"i"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><a href="5-ptd.html#SP19" class="function-link"><span class="function-syntax">IDTypeData::epilogue_for_say_HTML</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_say</span><span class="plain-syntax">, </span><span class="identifier-syntax">paste_format</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP28_1" class="paragraph-anchor"></a><b>&#167;28.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Describe the word sequence</span><span class="named-paragraph-number">28.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">=</span><span class="identifier-syntax">seq_from</span><span class="plain-syntax">; </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">seq_to</span><span class="plain-syntax">; </span><span class="identifier-syntax">j</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">j</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">seq_from</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">ix</span><span class="plain-syntax"> = </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">word_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">];</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ix</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="5-ptd.html#SP28_1_2" class="named-paragraph-link"><span class="named-paragraph">Describe a token in the word sequence</span><span class="named-paragraph-number">28.1.2</span></a></span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="5-ptd.html#SP28_1_1" class="named-paragraph-link"><span class="named-paragraph">Describe a fixed word in the word sequence</span><span class="named-paragraph-number">28.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd.html#SP28">&#167;28</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP28_1_1" class="paragraph-anchor"></a><b>&#167;28.1.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Describe a fixed word in the word sequence</span><span class="named-paragraph-number">28.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> *</span><span class="identifier-syntax">p</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Lexer::word_raw_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">word_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">]);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">tinted</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">p</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">p</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] == </span><span class="character-syntax">'/'</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">tinted</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">tinted</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">paste_format</span><span class="plain-syntax"> == </span><span class="constant-syntax">PASTE_PHRASE_FORMAT</span><span class="plain-syntax">) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::begin_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"phraseword"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%c"</span><span class="plain-syntax">, </span><span class="identifier-syntax">p</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">paste_format</span><span class="plain-syntax"> != </span><span class="constant-syntax">PASTE_PHRASE_FORMAT</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">tinted</span><span class="plain-syntax">)) </span><span class="identifier-syntax">HTML::end_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd.html#SP28_1">&#167;28.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP28_1_2" class="paragraph-anchor"></a><b>&#167;28.1.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Describe a token in the word sequence</span><span class="named-paragraph-number">28.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">paste_format</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">INDEX_PHRASE_FORMAT:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">writing_a_say</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"("</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">inv</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">found</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Invocations::get_token_as_parsed</span><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">ix</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Node::is</span><span class="plain-syntax">(</span><span class="identifier-syntax">found</span><span class="plain-syntax">, </span><span class="identifier-syntax">UNKNOWN_NT</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">HTML::begin_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"indexdullred"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">HTML::begin_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"indexdullgreen"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%W"</span><span class="plain-syntax">, </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">found</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">HTML::end_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" - "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Dash::note_inv_token_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">found</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">ix</span><span class="plain-syntax">].</span><span class="element-syntax">construct</span><span class="plain-syntax"> == </span><span class="constant-syntax">NEW_LOCAL_IDTC</span><span class="plain-syntax">)?</span><span class="identifier-syntax">TRUE:FALSE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="5-ptd.html#SP28_1_2_1" class="named-paragraph-link"><span class="named-paragraph">Describe what the token matches</span><span class="named-paragraph-number">28.1.2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">writing_a_say</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">")"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PASTE_PHRASE_FORMAT:</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"..."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd.html#SP28_1">&#167;28.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP28_1_2_1" class="paragraph-anchor"></a><b>&#167;28.1.2.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Describe what the token matches</span><span class="named-paragraph-number">28.1.2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">ix</span><span class="plain-syntax">].</span><span class="element-syntax">construct</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">STANDARD_IDTC:</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">spec</span><span class="plain-syntax"> = </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">ix</span><span class="plain-syntax">].</span><span class="element-syntax">to_match</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Specifications::is_kind_like</span><span class="plain-syntax">(</span><span class="identifier-syntax">spec</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">HTML::begin_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"phrasetokendesctext"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Kinds::Textual::write</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">ix</span><span class="plain-syntax">].</span><span class="element-syntax">token_kind</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">HTML::end_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Node::is</span><span class="plain-syntax">(</span><span class="identifier-syntax">spec</span><span class="plain-syntax">, </span><span class="identifier-syntax">CONSTANT_NT</span><span class="plain-syntax">)) ||</span>
<span class="plain-syntax">                    (</span><span class="identifier-syntax">Specifications::is_description</span><span class="plain-syntax">(</span><span class="identifier-syntax">spec</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">HTML::begin_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"phrasetokendesctext"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%W"</span><span class="plain-syntax">, </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">spec</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">HTML::end_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"i"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">HTML::begin_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"phrasetokenvaluetext"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Specifications::write_out_in_English</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">spec</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">HTML::end_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"i"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">NEW_LOCAL_IDTC:</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::begin_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"phrasetokentext"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"a new name"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::end_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">OLD_LOCAL_IDTC:</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::begin_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"phrasetokentext"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"a temporary named value"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="5-ptd.html#SP3" class="function-link"><span class="function-syntax">IDTypeData::token_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="identifier-syntax">ix</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">Kinds::eq</span><span class="plain-syntax">(</span><a href="5-ptd.html#SP3" class="function-link"><span class="function-syntax">IDTypeData::token_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="identifier-syntax">ix</span><span class="plain-syntax">), </span><span class="identifier-syntax">K_value</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" holding "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Kinds::Textual::write_articled</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><a href="5-ptd.html#SP3" class="function-link"><span class="function-syntax">IDTypeData::token_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="identifier-syntax">ix</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::end_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONDITION_IDTC:</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::begin_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"phrasetokentext"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"a condition"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::end_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">STORAGE_IDTC:</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::begin_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"phrasetokentext"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"a stored value"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::end_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TABLE_REF_IDTC:</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::begin_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"phrasetokentext"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"a table entry"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::end_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">KIND_NAME_IDTC:</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::begin_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"phrasetokentext"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"name of kind"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::end_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">VOID_IDTC:</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::begin_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"phrasetokentext"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"a phrase"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">HTML::end_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd.html#SP28_1_2">&#167;28.1.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP29" class="paragraph-anchor"></a><b>&#167;29. Problem messages.</b>Which enables this rather cool depiction used in Problem messages:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">IDTypeData::inv_write_HTML_representation</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inv</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">id_body</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idb</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_phrase_invoked</span><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax"> = &amp;(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">type_data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><a href="5-tpf.html#SP11" class="function-link"><span class="function-syntax">ToPhraseFamily::doc_ref</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">head_of_defn</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">pds</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">pds</span><span class="plain-syntax">, </span><span class="string-syntax">"%+W"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Wordings::one_word</span><span class="plain-syntax">(</span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><a href="5-tpf.html#SP11" class="function-link"><span class="function-syntax">ToPhraseFamily::doc_ref</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">head_of_defn</span><span class="plain-syntax">))));</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">DocReferences::link_to</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pds</span><span class="plain-syntax">, -1);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">pds</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">IndexUtilities::link_to</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><a href="5-id.html#SP10" class="function-link"><span class="function-syntax">ImperativeDefinitions::body_at</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">))), </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="5-ptd.html#SP28" class="function-link"><span class="function-syntax">IDTypeData::write_HTML_representation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="constant-syntax">INDEX_PHRASE_FORMAT</span><span class="plain-syntax">, </span><span class="identifier-syntax">inv</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Dash::reading_passed</span><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE:</span><span class="plain-syntax"> </span><span class="identifier-syntax">HTML_TAG_WITH</span><span class="plain-syntax">(</span><span class="string-syntax">"img"</span><span class="plain-syntax">, </span><span class="string-syntax">"border=0 src=inform:/doc_images/tick.png"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE:</span><span class="plain-syntax"> </span><span class="identifier-syntax">HTML_TAG_WITH</span><span class="plain-syntax">(</span><span class="string-syntax">"img"</span><span class="plain-syntax">, </span><span class="string-syntax">"border=0 src=inform:/doc_images/cross.png"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">default:</span><span class="plain-syntax"> </span><span class="identifier-syntax">HTML_TAG_WITH</span><span class="plain-syntax">(</span><span class="string-syntax">"img"</span><span class="plain-syntax">, </span><span class="string-syntax">"border=0 src=inform:/doc_images/greytick.png"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>

</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="5-tpf.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-am.html">1</a></li><li class="progresschapter"><a href="2-bv.html">2</a></li><li class="progresschapter"><a href="3-dlr.html">3</a></li><li class="progresschapter"><a href="4-nr.html">4</a></li><li class="progresscurrentchapter">5</li><li class="progresssection"><a href="5-id.html">id</a></li><li class="progresssection"><a href="5-idf.html">idf</a></li><li class="progresssection"><a href="5-adf.html">adf</a></li><li class="progresssection"><a href="5-tpf.html">tpf</a></li><li class="progresscurrent">ptd</li><li class="progresssection"><a href="5-ptd2.html">ptd2</a></li><li class="progresssection"><a href="5-po.html">po</a></li><li class="progresssection"><a href="5-rf.html">rf</a></li><li class="progresssection"><a href="5-rcd.html">rcd</a></li><li class="progresschapter"><a href="6-rls.html">6</a></li><li class="progresschapter"><a href="7-tc.html">7</a></li><li class="progresschapter"><a href="8-kpr.html">8</a></li><li class="progressnext"><a href="5-ptd2.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

